package com.gec.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gec.model.system.ITripArea;
import com.gec.model.system.ITripCity;
import com.gec.model.system.ITripItinerary;
import com.gec.model.vo.ITripAreaQueryVo;
import com.gec.system.mapper.ITripAreaMapper;
import com.gec.system.service.ITripAreaService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 省份表 服务实现类
 * </p>
 *
 * @author chenzhiling
 * @since 2024-01-22
 */
@Service
public class ITripAreaServiceImpl extends ServiceImpl<ITripAreaMapper, ITripArea> implements ITripAreaService {

    @Override
    public IPage<ITripArea> selectPage(IPage<ITripArea> page1, ITripAreaQueryVo iTripAreaQueryVo) {
        IPage<ITripArea> iPage = this.baseMapper.selectPage(page1, iTripAreaQueryVo, null);
        return iPage;
    }

    @Override
    public ITripArea selectByName(String name) {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("areaName",name);//相当于where name=1
        List<ITripArea> list = baseMapper.selectList(wrapper);
        return list.size()==0 ?null :list.get(0);
    }
}
